# Contributor: Michael Mason <ms13sp@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=knock
pkgver=0.8.1
pkgrel=0
pkgdesc="A simple port-knocking daemon"
url="http://www.zeroflux.org/projects/knock"
arch="all"
license="GPL-2.0-or-later"
depends="iptables"
makedepends="libpcap-dev autoconf automake"
install=
subpackages="$pkgname-doc $pkgname-openrc"
# Original hasnt been maintained in a long time - use this fork instead - includes IPv6 support
_fork="TDFKAOlli"
source="$pkgname-$pkgver.tar.gz::https://github.com/$_fork/$pkgname/archive/${pkgver}.tar.gz
	knock.initd
	knock.confd"
options="!check"

builddir="$srcdir/$pkgname-$pkgver"

build() {
	cd "$builddir"
	autoreconf -fi
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info
	make
}

package() {
	cd "$builddir"
	make DESTDIR="$pkgdir" install

	install -m755 -D "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/knockd
	install -m644 -D "$srcdir"/$pkgname.confd \
		"$pkgdir"/etc/conf.d/knockd
}

sha512sums="d921d66e1871e3503710ab4b5630f8ad677c6d76186a245422a7e310af0d3aa7741aea530922221cf592e68cde11c441d66379c0f37b5d84d9558f252493e5bd  knock-0.8.1.tar.gz
369010549a1b33efe9f634794f039249421778d49739e8f10e4d6baa83424e066a63c0ef637b70762ee34617e7b67f9ac6683125d35ded85d6779d6b2ef0f7db  knock.initd
63fa311e6adf21450d4c93008a9537ec1b3c0dbed28e3daf955f2761127d9d756f2f7a84d8357d81a5e1a5a48453f9179d0c18cf18af0b9f30437c862a438d7f  knock.confd"
